import { provideGlobalConfig } from './src/config-provider'

import type { App, Plugin } from '@vue/runtime-core'

import type { ConfigProviderContext } from './src/config-provider'

export const makeInstaller = (components: Plugin[] = []) => {
  const install = (app: App, options?: ConfigProviderContext) => {
    components.forEach((c) => app.use(c))

    if (options) provideGlobalConfig(options, app, true)
  }

  return {
    install,
  }
}
